package com.sfy.mapper;

import com.sfy.pojo.Dept;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;


//1.被mybatis识别 2.spring boot会自动创建实现类对象交给ioc容器管理
@Mapper
@Repository
public interface DeptMapper {

    @Select("select * from dept")
    List<Dept> selectAllDept();

    @Delete("delete from dept where id = #{id}")
    void deleteDeptById(Integer id);

    @Insert("insert into dept (name,create_time,update_time) values " +
            "(#{name},#{createTime},#{updateTime})")
    void addDept(Dept dept);

    @Update("update dept set name = #{name } , update_time = #{updateTime} where id = #{id}")
    void updateDept(Dept dept);

}
